﻿@using X.PagedList;
@using X.PagedList.Mvc.Core;
@{
	Layout = null;
}

<!DOCTYPE html>

<html>
<head>
	<meta name="viewport" content="width=device-width" />
	<title>PagedListForm</title>
	<style type="text/css">
		div, table, tr, td {
			margin: 0px;
			padding: 0px;
		}

		.myTable {
			width: 800px;
			margin: 20px auto;
			border-collapse: collapse;
		}

			.myTable td, .myTable th {
				height: 30px;
				line-heigh: 30px;
				padding: 6px;
			}

		#page li {
			list-style-type: none;
			display: inline-block;
			margin: 3px;
		}
	</style>
</head>
<body>
	<h1>查询员工信息</h1>
	<form style="text-align: center;">
		所属部门：
		<select name="ddlDept" id="ddlDept">
			<option value="">--请选择--</option>
			@foreach (var item in ViewBag.listDept)
			{
				int deptId = 0;
				if (!string.IsNullOrEmpty(Context.Request.Query["ddlDept"]))
				{
					deptId = int.Parse(Context.Request.Query["ddlDept"].ToString());
				}
				//option前加叹号取消语法检查
				<!option value="@item.DeptId" @(item.DeptId == deptId ? "selected" : "")>@item.DeptName</!option>
			}
		</select>
		员工姓名：
		<input type="text" name="txtRealName" id="txtRealNname" value="@Context.Request.Query["txtRealName"]" />
		<input type="submit" value="搜 索" />
	</form>
	<a href="AddForm" target="_blank">添加员工</a>
	<table class="myTable" border="1">
		<tr>
			<th>员工编号：</th>
			<th>部门名称：</th>
			<th>员工姓名：</th>
			<th>员工电话：</th>
			<th>所在地区：</th>
			<th>员工工资：</th>

		</tr>
		@foreach (var item in ViewBag.DataList)
		{


			<tr>
				<td>@item.EmpId</td>
				<td>@item.DeptName</td>
				<td>@item.EmpName</td>
				<td>@item.EmpPhone</td>
				<td>@item.EmpArea</td>
				<td>@item.EmpSalary</td>

			</tr>
		}
	</table>
	<div id="page">
		@Html.PagedListPager((IPagedList)ViewBag.DataList, page => Url.Action("PagedListForm", new { page, ddlDept = Context.Request.Query["ddlDept"], txtRealName = Context.Request.Query["txtRealName"] }))
	</div>

</body>
</html>
